using Boo.Lang;
using MaterialUI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class threeroundsystemcr : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024find_0024491 : GenericGenerator<WaitForSeconds>
	{
		internal threeroundsystemcr _0024self__0024493;

		public _0024find_0024491(threeroundsystemcr self_)
		{
			_0024self__0024493 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024493);
		}
	}

	public GameObject t;

	public restartcr restartt;

	private int state;

	public int playerpoints;

	public int aipoints;

	public winlosedrawoneroundr winlosedraw;

	public void Start()
	{
		UnityEngine.Object.DontDestroyOnLoad(t);
		StartCoroutine(find());
		ToastManager.Show("Round " + (1 + playerpoints + aipoints) + "/3", 1f);
	}

	public void OnLevelWasLoaded()
	{
		if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "mainmenu2" || UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "stadiumselect")
		{
			UnityEngine.Object.Destroy(gameObject);
		}
		else
		{
			ToastManager.Show("Round " + (1 + playerpoints + aipoints) + "/3", 1f);
		}
	}

	public IEnumerator find()
	{
		return new _0024find_0024491(this).GetEnumerator();
	}

	public void finished()
	{
		restartt = (GameObject.Find("Main Camera").GetComponent("restartcr") as restartcr);
		winlosedraw = (GameObject.Find("winlosedraw").GetComponent("winlosedrawoneroundr") as winlosedrawoneroundr);
		if (aipoints == 2)
		{
			ToastManager.Show("Duel lost: " + playerpoints + " - " + aipoints, 2f);
			winlosedraw.tc.won = false;
			winlosedraw.quit();
			UnityEngine.Object.Destroy(gameObject);
		}
		if (playerpoints == 2)
		{
			ToastManager.Show("Duel won: " + playerpoints + " - " + aipoints, 2f);
			winlosedraw.tc.won = true;
			winlosedraw.quit();
			UnityEngine.Object.Destroy(gameObject);
		}
		if (aipoints == 1 || playerpoints == 1)
		{
			StartCoroutine(restartt.restart());
		}
	}

	public void Main()
	{
	}
}
